using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameVuTru.ManagerScreens;
namespace GameVuTru.GameObject
{
    public enum OBJECTTYPE { OBJECT, ENEMY,BONUS,BULLET,BOOM };
    public enum BONUSTYPE { REDBOX,BLUEBOX,YELLOWBOX,THREECOLORBOX,COINBOX,SHIELD};
    public enum BULLETTYPE { BULLETBLUE, BULLETRED,BULLETYELLOW, BULLETENEMY }
    public enum EXPLOSIONTYPE { PLAYEREXPLOSION, SLIVEREXPLOSION, YELLOWEXPLOSION, REDEXPLOSION ,DUCKEXPLOSION,BOOMEXPLOSION}
    public class CObject
    {
        public CSprite m_sprite;
        public Vector2 postion;
        public OBJECTTYPE typeobject;
        public Vector2 vecloc;
        public Vector2 Postion
        {
            get { return postion; }
            set { postion = value; }
        }
        public Rectangle bound;

        public Rectangle Bound
        {
            get { return bound; }
            set { bound = value; }
        }
        public float speed;

        public float Speed
        {
            get { return speed; }
            set { speed = value; }
        }
        public bool isCollision;

        public bool IsCollision
        {
            get { return isCollision; }
            set { isCollision = value; }
        }
        public bool isvisible;

        public bool Isvisible
        {
            get { return isvisible; }
            set { isvisible = value; }
        }
        //khoi tao
        public CObject()
        {
            //textureObject = null;
            postion = Vector2.Zero;
            bound = new Rectangle();
            isCollision = false;
            isvisible = true;
            m_sprite = new CSprite();
            typeobject = OBJECTTYPE.OBJECT;

        }
        //cac ham ao can thiet
        public virtual void Update(GameTime gametime)
        {
            setbound();
        }
        public virtual void Update(GameTime gametime, List<CObject> listobject)
        {
            setbound();
            for (int i = 0; i < listobject.Count; i++)
            {
                if (listobject[i].isvisible)
                {
                    UpdateCollion(listobject[i]);
                }
            }
        }
        public virtual void Draw(SpriteBatch sp)
        {
            if (isvisible)
            {
                m_sprite.DrawSprite(sp, postion);
            }

        }
        public virtual void UpdateCollion(CObject b)
        {
        }
        public void setbound()
        {
            bound = new Rectangle((int)(postion.X - m_sprite.widthsprite / 2), (int)(postion.Y - m_sprite.heightsprite / 2), m_sprite.widthsprite, m_sprite.heightsprite);
        }
        public virtual void moveleft(int x)
        {

        }
        public virtual void moveRight(int x)
        {

        }
        public virtual void moveTop(int y)
        {

        }
        public virtual void moveBottom(int y)
        {

        }
    }
}
